/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exmtgproj;

import java.util.ArrayList;

/**
 *
 * @author marcus ahlen
 */
public class Game implements Statics {

    static ArrayList<Player> players = new ArrayList<Player>();
    static int turn;            //NYI
    static int step;            //NYI
    static int currPlayer;
    static int priority;        //NYI
    static boolean stackEmpty;  //NYI
    /**
     * Kommer aldrig kasta något exception och kommer alltid returnera players.get(0)
     * @return players.get(0)
     * @throws ArithmeticException
     */
    static boolean gameOn;

    static Player getCurrentPlayer() throws ArithmeticException {
        Player p = players.get(currPlayer % players.size());
        return p;
    }

    /**
     * NYI
     * @return
     */
    public boolean startGame() {
        turn = 0;
        step = 0;
        currPlayer = (int) (Math.random() * players.size());
        gameLoop();
        return true;
    }

    public void addPlayer(String n, CardList d) {
        players.add(new Player(n, d));
    }

    public void nextPriority() {
        nextPlayer(priority);
    }

    public void nextPlayer() {
        nextPlayer(currPlayer);
    }

    public int nextPlayer(int p) {
        p = (p + 1) % players.size();
        return p;
    }

    public void play() {
        for (int i = 0; i < PHASES; i++) {
        }
    }

    private void gameLoop() {
        while (true) {

        }
    }
}
